{% extends "base.html" %}

{% block content %}

    <div class="link_content">
      <div class="link_out"><a href="/visit?key={{ link.key }}">{{ link.title }}</a></div>
      <div class="link_details">{{ link.url }} - {{ link.hits }} treff</div>
      <div class="link_desc">
	{% if link.description %}
	  {{ link.description }}
	{% else %}
	  <em>Ingen beskrivelse</em>
        {% endif %}
      </div>
      <div class="link_date">Lagt til: {{ link.date }}</div>
      <p />

      <div class="link_comments">{% if link.comments.count %} {{ link.comments.count }} kommentarer:{% else %}Ingen kommentarer{% endif %}</div>
      {% for comment in link.comments %}
        <div class="comment">{{ comment.comment }}<br />
        <em>- {% if comment.author %}{{ comment.author.nickname }}{% else %}nobody{% endif %}, {{ comment.date }}</em></div>
      {% endfor %}

      <form action="/post_comment" method="post">
        <input type="hidden" name="key" value="{{ link.key }}" />
        <div>Skriv kommentar</div>
        <div><textarea name="comment" cols="30" rows="6"></textarea></div>
        <div><input type="submit" value="Legg inn kommentar" /></div>
      </form>
    </div>

{% endblock %}
